package org.ls.petclinic.web;

import org.ls.petclinic.dao.AccessDao;
import org.ls.petclinic.dao.impl.AccessDaoImpl;
import org.ls.petclinic.untils.JdbcUtils;
import org.ls.petclinic.untils.WebUtils;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Description
 * @Author 浪矢先生
 * @Create 2022-06-11 19:44
 */
@WebServlet(urlPatterns = "/deleteAccess")
public class DeleteVisitServlet extends BaseServlet{

    private AccessDao accessDao=new AccessDaoImpl();
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = WebUtils.parseInt(req.getParameter("id"), 0);
        accessDao.deleteById(id);
        JdbcUtils.commitAndClose();
    }
}
